<%@page import="mall.service.impl.CategoryServiceImpl"%>
<%@page import="mall.bean.Category"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%
	request.setCharacterEncoding("UTF-8");
	// 取表单数据
	long cid = Long.parseLong(request.getParameter("cid"));
	String categoryName = request.getParameter("categoryName");
	String parentId = request.getParameter("parentId");
	String sortValue = request.getParameter("sortValue");
	String level = request.getParameter("level");
	// 更新到数据库
	Category obj = new Category();
	obj.setCid(cid);
	obj.setName(categoryName);
	obj.setParentId(Long.parseLong(parentId));
	obj.setParent(false);
	obj.setSort(Integer.parseInt(sortValue));
	obj.setLevel(Integer.parseInt(level));
	CategoryServiceImpl service = new CategoryServiceImpl();
	service.update(obj);
	// 跳转回列表页
	response.sendRedirect("category-list.jsp");
%>
